/* $Id: show_game.h jjs $ */
/*
   Copyright (C) 2007 by Jurjen Stellingwerff <jurjen@stwerff.xs4all.nl>
   Part of the Moros Project http://moros.sourceforge.net/

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY.

   See the COPYING file for more details.
*/
#ifndef SHOW_GAME_H
#define SHOW_GAME_H

#include <gtkmm.h>
#include <libglademm.h>
#include "list_games.h"

/// Screen to edit game data

class show_game : public Gtk::Window {
  public:
	show_game(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml> refGlade); ///< window
	virtual ~show_game();   ///< remove window data
	void load(long gamenr); ///< Read data of a game
	sigc::signal<void> signal_changed; ///< Signal to trigger when the game is edited

  protected:
	int game_nr;
	Glib::RefPtr<Gnome::Glade::Xml> glade;
	Gtk::Entry* name;
	Gtk::TextView* description;
	Glib::RefPtr<Gtk::TextBuffer> desc_buffer;
	Gtk::Entry* join;
	Gtk::Entry* goal;
	Gtk::Entry* map_name;
	Gtk::Entry* owner;
	Gtk::TreeView* party_list;
	Glib::RefPtr<Gtk::ListStore> party_store;
	Glib::RefPtr<Gtk::ListStore> join_store;
	Glib::RefPtr<Gtk::ListStore> goal_store;

	Gtk::Button* cancel_game;
	virtual void clicked_cancel();
	Gtk::Button* join_game;
	virtual void clicked_join_game();

	class ModelColumns : public Gtk::TreeModelColumnRecord {
	  public:
    	Gtk::TreeModelColumn<Glib::ustring> name;
    	Gtk::TreeModelColumn<Glib::ustring> description;
    	ModelColumns() {
			add(name);
			add(description);
		}
	};
	const ModelColumns cols;
};

#endif //show_game_H
